package pl.mcnova.model.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "phone_numbers")
public class PhoneNumber implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4600343319228652470L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id")
	private Integer id;

	private String number;

	@ManyToOne
	@JoinColumn(name = "Contractor_Id")
	private Contractor contractor;

	public PhoneNumber() {

	}

	public PhoneNumber(String number, Contractor contractor) {
		setNumber(number);
		setContractor(contractor);
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getId() {
		return id;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public String getNumber() {
		return number;
	}

	public void setContractor(Contractor contractor) {
		this.contractor = contractor;
	}

	public Contractor getContractor() {
		return contractor;
	}

	@Override
	public String toString() {
		return number;
	}

}
